package com.pavelk.orion.view
{
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	import com.pavelk.orion.view.components.StageView;
	import com.pavelk.orion.view.components.BaseView;

	public class StageMediator extends BaseMediator implements IMediator
	{
		public static const NAME:String	= 'StageMediator';
		
		//private var stageView:StageView;
		private var stageView:BaseView;
		
		public function StageMediator( viewComponent:Object )
		{
			super( NAME, viewComponent );
		}
		
		override public function onRegister() : void
		{
			//stageView = new StageView();
			stageView = new BaseView();
			viewComponent.addChild( stageView );
		}
		
		override public function getViewComponent() : Object
		{
			return stageView;
		}
		
		override public function listNotificationInterests() : Array 
        {
            return [ 
                     	ApplicationConstants.ASSETS_DATA                	
                   ];
        }
        
        override public function handleNotification( note:INotification ) : void 
        {
            switch ( note.getName() ) 
            {
            	case ApplicationConstants.ASSETS_DATA:
	               stageView.addAssetss( note.getBody() as Object );
	               break;
            }
        }    		
	}
}